package com.weixing.mall.provider.model.vo.report.customer;

import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.weixing.mall.base.constant.GlobalConstant;
import com.weixing.mall.core.enums.OrderSysTagEnum;
import com.weixing.mall.provider.api.model.enums.OrderTypeEnum;
import com.weixing.mall.provider.model.enums.*;
import com.weixing.mall.provider.support.excel.EnumConverter.AfterSaleAuditConverter;
import com.weixing.mall.provider.support.excel.EnumConverter.OrderStatusConverter;
import com.weixing.mall.provider.support.excel.EnumConverter.OrderSysTagConverter;
import com.weixing.mall.provider.support.excel.EnumConverter.OrderTypeConverter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Date;

/**
 * @author Small
 * @since 2020-05-07
 */
@Data
@ApiModel(value="CustomerReportDetailVo", description="报表明细")
@ContentRowHeight(40)
public class CustomerReportDetailVo {
    @ApiModelProperty(value = "订单Id")
    @ExcelIgnore
    private Long id;
    @ApiModelProperty(value = "订单金额")
    @ExcelIgnore
    private BigDecimal orderPrice;
    @ApiModelProperty(value = "实付金额")
    @ExcelIgnore
    private BigDecimal actualPrice;
    @ApiModelProperty(value = "是否支付（0未支付 1已支付）")
    @ExcelIgnore
    private Integer isPay;
    @ApiModelProperty(value = "下单来源 1客服下单，2代理商下单，3客户下单")
    @ExcelIgnore
    private OrderFromEnum orderFrom;
    @ApiModelProperty(value = "订单商品状态（ProductStatusEnum 1待定；4待货；7有现货；10需外采；13内部换货；16断货））")
    @ExcelIgnore
    private ProductStatusEnum itemStatus;
    @ApiModelProperty(value = "是否是认领订单")
    @ExcelIgnore
    private Integer isCliam;
    @ApiModelProperty(value = "货品ID")
    @ExcelIgnore
    private Long productId;
    @ApiModelProperty(value = "商品ID")
    @ExcelIgnore
    private Long goodsId;


    @ApiModelProperty(value = "商品图片")
    @ExcelIgnore
    private String goodsImg;
    @ExcelProperty("商品图片")
    @ColumnWidth(10)
    private URL goodsImgUrl;
    public void setGoodsImg(String goodsImg) {
        this.goodsImg = goodsImg;
        try {
            if (StrUtil.isNotEmpty(goodsImg)){
                this.goodsImgUrl=new URL(GlobalConstant.IMG_PATH_URL+goodsImg+GlobalConstant.IMG_PATH_URL_SUFFIX);
            }
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
    }
    @ApiModelProperty(value = "订单编号(订单识别码)")
    @ExcelProperty("订单编号")
    private String orderSn;
    @ApiModelProperty(value = "支付流水号")
    @ExcelProperty("支付流水号")
    private String outTradeNo;
    @ApiModelProperty(value = "商品名称")
    @ExcelProperty("商品名称")
    private String goodsName;
    @ApiModelProperty(value = "商品款号--修改")
    @ExcelProperty("商品款号")
    private String styleNo;
    @ApiModelProperty(value = "商品货号")
    @ExcelProperty("商品货号")
    private String goodsSn;
    @ApiModelProperty(value = "商品分类")
    @ExcelProperty("商品分类")
    private String catName;
    @ApiModelProperty(value = "商品专区")
    @ExcelProperty("商品专区")
    private String partitionName;
    @ApiModelProperty(value = "吊牌价---修改")
    @ExcelProperty("吊牌价")
    private BigDecimal marketPrice;
    @ApiModelProperty(value = "数量")
    @ExcelProperty("数量")
    private Integer quantity;
    @ApiModelProperty(value = "零售价")
    @ExcelProperty("零售价")
    private BigDecimal price;
    @ApiModelProperty(value = "折扣价格")
    @ExcelProperty("折扣价格")
    private BigDecimal discountPrice;
    @ApiModelProperty(value = "审批人当时折扣：指按照登录角色的折扣")
    @ExcelProperty("审批人当时折扣")
    private BigDecimal auditorDiscount;
    @ApiModelProperty(value = "下级折扣")
    @ExcelProperty("下级折扣")
    private BigDecimal childDiscount;
    @ApiModelProperty(value = "客服审核员名称--修改")
    @ExcelProperty("客服审核员")
    private String customerName;
    @ApiModelProperty(value = "客服审核时间---修改")
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ExcelProperty("客服审核时间")
    private Date auditTime;
    @ApiModelProperty(value = "非客服上级：除客服以外的代理关系的下单的上级---修改")
    @ExcelProperty("非客服上级")
    private String buyerHigher;
    @ApiModelProperty(value = "所属经销商名称")
    @ExcelProperty("经销商")
    private String distributorName;
    @ApiModelProperty(value = "收货地址-联系人（姓名）")
    @ExcelProperty("姓名")
    private String contactUser;
    @ApiModelProperty(value = "收货地址-联系电话（手机号）")
    @ExcelProperty("手机号")
    private String contactPhone;
    @ApiModelProperty(value = "收货地址")
    @ExcelProperty("地址")
    private String address;
    @ApiModelProperty(value = "客户身高")
    @ExcelProperty("身高")
    private Integer height;
    @ApiModelProperty(value = "客户体重")
    @ExcelProperty("体重")
    private BigDecimal weight;
    @ApiModelProperty(value = "订单类型 1正价订单；2代理商活动订单；3秒杀订单")
    @ExcelProperty(value = "订单类型",converter = OrderTypeConverter.class)
    private OrderTypeEnum orderType;
    @ApiModelProperty(value = "活动名称")
    @ExcelProperty("活动名称")
    private String actName;
    @ApiModelProperty(value = "下单人")
    @ExcelProperty("下单人")
    private String buyer;
    @ApiModelProperty(value = "所属代理商名称")
    @ExcelProperty("所属代理")
    private String agentName;
    @ApiModelProperty(value = "所属代理折扣,下单代理的折扣---修改")
    @ExcelProperty("所属代理折扣")
    private BigDecimal discount;
    @ApiModelProperty(value = "所属代理优惠ID")
    @ExcelProperty("所属代理优惠ID")
    private Long agentSn;
    @ApiModelProperty(value = "商品码（订单识别码）")
    @ExcelProperty("订单识别码")
    private String commodityCode;
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "订单创建时间（下单时间）")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ExcelProperty("下单时间")
    private Date createdTime;
    @ApiModelProperty(value = "订单状态（1待付款;4已取消;7已付款/待审核;10,审核中;13;审核完成/待封单;16已封单;19待发货;22已发货;25已完成;28售后中）")
    @ExcelProperty(value = "订单状态",converter = OrderStatusConverter.class)
    private OrderStateEnum orderStatus;
    @ApiModelProperty(value = "订单标签")
    @ExcelProperty(value = "订单标签",converter = OrderSysTagConverter.class)
    private OrderSysTagEnum sysTag;
    @ApiModelProperty(value = "所属发货员名称")
    @ExcelProperty("发货员")
    private String shipperName;
    @ApiModelProperty(value = "退货,断货,取消的确认人(客服名称)")
    @ExcelProperty("确认人")
    private String confirmName;
    @ApiModelProperty(value = "售后状态（AfterSaleAuditEnum 1,\"待审核\"，3,\"客户已审核\"，6,\"客服已拒绝\"）")
    @ExcelProperty(value = "售后状态",converter = AfterSaleAuditConverter.class)
    private AfterSaleAuditEnum afterSaleStatus;
    @ApiModelProperty(value = "退货,确认时间--修改")
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ExcelProperty("售后确认时间")
    private Date auditedTime;
    @ApiModelProperty(value = "上级需退款")
    @ExcelProperty("上级需退款")
    private BigDecimal refundHigherAmount;
    @ApiModelProperty(value = " 需退下级款")
    @ExcelProperty("需退下级款")
    private BigDecimal refundLowerAmount;
    @ApiModelProperty(value = "退款给哪一位下级名称")
    @ExcelProperty("退款对象")
    private String refundObjectName;
    @ApiModelProperty(value = "售后客服备注")
    @ExcelProperty("备注")
    private String customerRemark;

    @ApiModelProperty(value = "sku")
    @ExcelIgnore
    private String skuDesp;
    @ApiModelProperty(value = "颜色")
    @ExcelIgnore
    private String color;
    @ApiModelProperty(value = "尺码")
    @ExcelIgnore
    private String size;



    @ApiModelProperty(value = "商品类目id")
    @ExcelIgnore
    private Long catId;

    @ApiModelProperty(value = "商品品牌Id")
    @ExcelIgnore
    private Long brandId;
    @ApiModelProperty(value = "品牌名称")
    @ExcelIgnore
    private String brandName;



    @ApiModelProperty(value = "折扣价格的折扣")
    @ExcelIgnore
    private BigDecimal discountPriceDiscount;
    @ApiModelProperty(value = "成本价")
    @ExcelIgnore
    private BigDecimal costPrice;
    @ApiModelProperty(value = "所属客服id")
    @ExcelIgnore
    private Long customerId;


    @ApiModelProperty(value = "所属经销商Id")
    @ExcelIgnore
    private Long distributorId;




    @ApiModelProperty(value = "下单人Id")
    @ExcelIgnore
    private Long buyerId;

    @ApiModelProperty(value = "所属代理商Id 所属代理:下单人的直属代理,也有可能是代理自己下的单")
    @ExcelIgnore
    private Long agentId;





    @ApiModelProperty(value = "所属发货员Id")
    @ExcelIgnore
    private Long shipperId;
    @ApiModelProperty(value = "退货,断货,取消的确认人Id（客服Id）")
    @ExcelIgnore
    private Long confirmId;
    @ApiModelProperty(value = "售后结果（AfterSaleResultEnum 3,\"入App仓\"，4,\"入次品仓\"，7,\"问题订单\"，10,\"驳回\"）")
    @ExcelIgnore
    private AfterSaleResultEnum afterSaleResult;


    @ApiModelProperty(value = "退款给哪一位下级id")
    @ExcelIgnore
    private Long refundObjectId;



    @ApiModelProperty(value = "活动Id")
    @ExcelIgnore
    private Long actId;
    @ApiModelProperty(value = "售后类型 1退货；2换货")
    @ExcelIgnore
    private Integer afterSaleType;
    @ApiModelProperty(value = "断货确认时间--修改")
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    @ExcelIgnore
    private Date nosuppllyTime;
    @ApiModelProperty(value = "取消时间--修改")
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    @ExcelIgnore
    private Date canceledTime;

    @ApiModelProperty(value = "订单审核状态（OrderAuditStateEnum 1代理商待审核;3代理商审核中；6代理商审核完成客服待审核；9客服审核完成；12客服审核拒绝）")
    @ExcelIgnore
    private OrderAuditStateEnum auditStatus;
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "订单更新时间")
    @ExcelIgnore
    private Date updatedTime;
    @ApiModelProperty(value = "代理商认领时间轴")
    @ExcelIgnore
    private String agentCliamLine;

}
